#!/bin/bash

source internal/docker/docker_env.sh
source scripts/common.sh

# get deployed contract address.
PACAYA_DEPLOYMENT_JSON=$(cat ${PACAYA_FORK_TAIKO_MONO}/packages/protocol/deployments/deploy_l1.json)
DEPLOYMENT_JSON=$(cat ${SHASTA_FORK_TAIKO_MONO}/packages/protocol/deployments/deploy_l1.json)
export PACAYA_INBOX=$(echo "$PACAYA_DEPLOYMENT_JSON" | jq '.taiko' | sed 's/\"//g')
export SHASTA_INBOX=$(echo "$DEPLOYMENT_JSON" | jq '.shasta_inbox' | sed 's/\"//g')
export TAIKO_ANCHOR=0x1670010000000000000000000000000000010001
export TAIKO_TOKEN=$(echo "$PACAYA_DEPLOYMENT_JSON" | jq '.taiko_token' | sed 's/\"//g')
export PROVER_SET=$(echo "$PACAYA_DEPLOYMENT_JSON" | jq '.prover_set' | sed 's/\"//g')
export TAIKO_WRAPPER=$(echo "$PACAYA_DEPLOYMENT_JSON" | jq '.taiko_wrapper' | sed 's/\"//g')
export FORCED_INCLUSION_STORE=$(echo "$PACAYA_DEPLOYMENT_JSON" | jq '.forced_inclusion_store' | sed 's/\"//g')
export COMPOSE_VERIFIER=$(echo "$PACAYA_DEPLOYMENT_JSON" | jq '.proof_verifier' | sed 's/\"//g')
export L1_CONTRACT_OWNER_PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
export L1_PROPOSER_PRIVATE_KEY=0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a
export L2_SUGGESTED_FEE_RECIPIENT=0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
export L1_PROVER_PRIVATE_KEY=0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d
export TEST_ACCOUNT_PRIVATE_KEY=0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6
export TREASURY=0x1670010000000000000000000000000000010001
export VERBOSITY=${VERBOSITY-3}

# Print the environment variables.
echo "RUN_TESTS=true
L1_HTTP=$L1_HTTP
L1_WS=$L1_WS
L2_SUGGESTED_FEE_RECIPIENT=$L2_SUGGESTED_FEE_RECIPIENT
L2_HTTP=$L2_HTTP
L2_WS=$L2_WS
L2_AUTH=$L2_AUTH
PACAYA_INBOX=$PACAYA_INBOX
SHASTA_INBOX=$SHASTA_INBOX
TAIKO_WRAPPER=$TAIKO_WRAPPER
FORCED_INCLUSION_STORE=$FORCED_INCLUSION_STORE
COMPOSE_VERIFIER=$COMPOSE_VERIFIER
TAIKO_ANCHOR=$TAIKO_ANCHOR
TAIKO_TOKEN=$TAIKO_TOKEN
PROVER_SET=$PROVER_SET
L1_CONTRACT_OWNER_PRIVATE_KEY=$L1_CONTRACT_OWNER_PRIVATE_KEY
L1_PROPOSER_PRIVATE_KEY=$L1_PROPOSER_PRIVATE_KEY
L1_PROVER_PRIVATE_KEY=$L1_PROVER_PRIVATE_KEY
TEST_ACCOUNT_PRIVATE_KEY=$TEST_ACCOUNT_PRIVATE_KEY
TREASURY=$TREASURY
JWT_SECRET=$JWT_SECRET
VERBOSITY=$VERBOSITY
TAIKO_INTERNAL_SHASTA_TIME=$TAIKO_INTERNAL_SHASTA_TIME
ANVIL_INTERNAL_SHASTA_TIME=$ANVIL_INTERNAL_SHASTA_TIME" > integration_test/.env
